The present invention relates to a vector processor, and more particularly to a vector processor suitable for join process for a relational data base.
FIG. 7A illustrates a join process in a relational data base. In FIG. 7A, data in a part name table 701 and a price table 702 which have the same part number are joined in one line to prepare a join table 703.
In a normal relational data base, each line (record) of each table is not recorded in a continuous area of one storage (for example, magnetic disk) but is recorded dispersedly in many areas. Accordingly, a long time is required to read various required data of tables in the join process.
The data base stores indexes 707 and 708 for tables 701 and 702. The indexes store record numbers of lines (records) of the tables. When a record number is given, a corresponding record in the table can be read. The indexes 707 and 708 are not stored as a table in the data base although they are shown in a form of table. Since the indexes are also in the magnetic disk, a long time is required to read them.
In the prior art, the join process is normally performed by scalar processing by a scalar processor. Thus, after readout of an element in a table from the storage and processing thereof, the next element is processed. As a result, the join process requires a long time. As an approach to resolve this problem, U.S. Pat. No. 4,644,471 assigned to the assignee of the present invention discloses a method for translating tables of a relational data base to vectors. EU-A-149213 or corresponding U.S. Patent application Ser. 685,116 assigned to the assignee of the present invention discloses a vector processor for processing such vectors at a high speed. In the latter vector processor, each vector operand is independently controlled and a data format of a vector element is expanded to enable vectorization of a merge operation which is frequently used in the relational data base processing.
As shown in FIG. 7B, two vectors 704 and 705 are stored in a main memory as information equivalent to information of the tables shown in FIG. 7A, and those vectors are processed to write one vector 706 into the main memory. The term vector means data stored to be continuously read from the memory. Specifically, it means data stored at constantly displaced memory locations of the main memory. Each vector element comprises two fields (four-byte length each) called a front field (for example 704A) and a rear field (for example 704B). The rear field 704B of each element of the first input vector 704 comprises one of part numbers P.sub.2, P.sub.3, P.sub.8 and P.sub.9 of one of part name tables 701, and the front field 704A comprises corresponding one of record numbers .alpha., .beta., .gamma. and .delta. of the indexes 707. Similarly, the second input vector 705 contains information of a price table 702 and the indexes 708. The elements of the two input vectors 704 and 705 are sequentially compared by an operation unit starting from the leading ones, and vectors having elements which are pair of record numbers in the front fields of two elements having the same rear field content, for example, (.alpha..sub.1, .alpha..sub.2,) and (.gamma..sub.1, .delta..sub.2), of the elements of the input vectors 704 and 705 are outputted as an operation result output vector 706 (step 707). The records corresponding to the pair of record numbers in the output vector 706 are read from the tables 1 and 2 (FIG. 7A) to prepare the join table 703 of FIG. 7A (step 708).
In the above prior art system, it is necessary to previously store in the front fields 704A and 705A tags to identify lines of tables at which the part numbers stored in the rear fields 704B and 705B of the input vectors 704 and 705 have been stored in order to derive the join table 703 from the output vector 706. As a result, a long process time is required. Since many tables are used in the relational data base, when they are to be stored in the main memory as vectors, a time required to store the front fields raises a serious problem.
Further, since each vector requires the front field, the amount of data of each vector increases and a larger area in the main memory is occupied by the vectors. Since many tables are used in the relational data base, when they are vectorized, the memory area of the main memory occupied by the front fields of the vectors materially increases.